home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 27 / CDROM27.iso / share / progra / mai / Controls, TextBox - Returning a particular line < prev    next >
Encoding:
Text File  |  1997-07-15  |  751 b   |  22 lines

  1. 'Description: Return a particular line from a TextBox
  2.  
  3. 'Global Const WM_USER = &H400
  4. 'Global Const EM_GETLINE = WM_USER + 20
  5.  
  6. 'Function TextBoxLine (TB As TextBox, ByVal LineNO As Integer) As String
  7.     Const BUFLEN = 1028
  8.         Dim buffer As String * BUFLEN
  9.         ' Set 1st 2 bytes to Buffer length
  10.      Mid(buffer, 1, 1) = Chr(BUFLEN And &HFF)
  11.     Mid(buffer, 2, 1) = Chr(BUFLEN \ &H100)
  12.     If Not TB.MultiLine Then
  13.             TextBoxLine = TB.Text
  14.         Else
  15.                 ret& = sendmessage(TB.hWnd, EM_GETLINE, LineNO - 1, ByVal buffer)
  16.                 If ret& Then
  17.                     TextBoxLine = Left$(buffer, ret&)
  18.                 Else
  19.                         TextBoxLine = ""
  20.                 End If
  21.         End If
  22. 'End Function